<%@ page import="com.nananer7.dao.IdeaDao" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="com.nananer7.dao.CommentDao" %>
<%@ page import="com.nananer7.dao.UserDao" %><%--
  Created by IntelliJ IDEA.
  User: nananer7
  Date: 2018/3/22
  Time: 15:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="lt-ie9 lt-ie8" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="lt-ie9" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en-US"> <!--<![endif]-->
<head>
    <!-- META TAGS -->
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>BrainStorming</title>

    <link rel="shortcut icon" href="images/favicon.png" />




    <!-- Style Sheet-->
    <link rel="stylesheet" href="style.css"/>
    <link rel='stylesheet' id='bootstrap-css-css'  href='css/bootstrap5152.css?ver=1.0' type='text/css' media='all' />
    <link rel='stylesheet' id='responsive-css-css'  href='css/responsive5152.css?ver=1.0' type='text/css' media='all' />
    <link rel='stylesheet' id='pretty-photo-css-css'  href='js/prettyphoto/prettyPhotoaeb9.css?ver=3.1.4' type='text/css' media='all' />
    <link rel='stylesheet' id='main-css-css'  href='css/main5152.css?ver=1.0' type='text/css' media='all' />
    <link rel='stylesheet' id='custom-css-css'  href='css/custom5152.html?ver=1.0' type='text/css' media='all' />


    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="js/html5.js"></script></script>
    <![endif]-->

</head>

<body>

<!-- Start of Header -->
<div class="header-wrapper">
    <header>
        <div class="container">


            <div class="logo-container">
                <!-- Website Logo -->
                <a href="index.jsp"  title="BrainStorming">
                    <img src="images/logo.png" alt="BrainStorming">
                </a>
                <span class="tag-line">Tomorrow is another day.</span>
            </div>


            <!-- Start of Main Navigation -->
            <nav class="main-nav">
                <div class="menu-top-menu-container">
                    <ul id="menu-top-menu" class="clearfix">
                        <li><a href="index.jsp">Home</a></li>
                        <li><a href="home-categories-articles.jsp">Home 3</a></li>
                        <li><a href="articles-list.jsp">Ideas List</a></li>
                        <li><a href="faq.jsp">FAQs</a></li>
                        <li><a href="#">Skins</a>
                            <ul class="sub-menu">
                                <li><a href="blue-skin.jsp">Blue Skin</a></li>
                                <li><a href="green-skin.jsp">Green Skin</a></li>
                                <li><a href="red-skin.jsp">Red Skin</a></li>
                                <li><a href="index.jsp">Default Skin</a></li>
                            </ul>
                        </li>
                        <li><a href="contact.jsp">Contact</a></li>
                        <li><a href="#">More</a>
                            <ul class="sub-menu">
                                <li><a href="full-width.jsp">Full Width</a></li>
                                <li><a href="elements.jsp">Elements</a></li>
                                <li><a href="page.jsp">Sample Page</a></li>
                            </ul>
                        </li>
                        <li><a href="share-ideas.jsp">Share</a></li>
                        <%
                            String username=(String)session.getAttribute("username");
                            if(username!=null){
                        %>
                        <li><a href="#">欢迎你，${username}</a>
                            <ul class="sub-menu">
                                <li><a href="login.jsp">切换用户</a></li>
                                <li><a href="regist.jsp">新用户注册</a></li>
                                <li><a href="logout.jsp">退出登录</a></li>
                            </ul>
                        </li>
                        <%
                        }else{
                        %>
                        <li><a href="login.jsp">未登录</a></li>
                        <%
                            }
                        %>
                    </ul>
                </div>
            </nav>
            <!-- End of Main Navigation -->

        </div>
    </header>
</div>
<!-- End of Header -->

<!-- Start of Page Container -->
<div class="page-container">
    <div class="container">
        <div class="row">

            <!-- start of page content -->
            <div class="span8 page-content">
                <%

                    Integer id=Integer.parseInt(request.getParameter("id"));
                    String iid = String.valueOf(id);
                    String subject =new IdeaDao().findSubjectByIid(id);
                    String description =new IdeaDao().findDescriptionByIid(id);
                    String categories =new IdeaDao().findCategoriesByIid(id);
                    int likes= new IdeaDao().findLikesByIid(id);

                    Date date1 = new Date();
                    date1 = new IdeaDao().findTimeByIid(id);
                    int year1= date1.getYear()+1900;
                    int month1=date1.getMonth()+1;
                    String MON1=new IdeaDao().changeMon(month1);
                    int day1 = date1.getDate();
                %>

                <ul class="breadcrumb">
                    <li><a href="#">BrainStorming</a><span class="divider">/</span></li>
                    <li><a href="#" title="View all posts in Server &amp; Database"><%=categories%></a> <span class="divider">/</span></li>
                    <li class="active"><%=subject%></li>
                </ul>

                <%
                    CommentDao commentDao= new CommentDao();
                    List<CommentDao> commentDaos= commentDao.findCommentsByIid(id);
                %>


                <article class=" type-post format-standard hentry clearfix">

                    <h1 class="post-title"><a href="#"><%=subject%></a></h1>

                    <div class="post-meta clearfix">
                        <span class="date"><%=day1%>&nbsp;<%=MON1%>,&nbsp;<%=year1%></span>
                        <span class="category"><a href="#" title="View all posts in Server &amp; Database"><%=categories%></a></span>
                        <span class="comments"><a href="#" title="Comment on Integrating WordPress with Your Website"><%=commentDaos.size()%>&nbsp;Comments</a></span>
                        <span class="like-count"><%=likes%></span>
                    </div><!-- end of post meta -->

                    <p><%=description%></p>

                </article>

                <div class="like-btn">

                    <form id="like-it-form" action="#" method="post">
                        <span class="like-it ">66</span>
                        <input type="hidden" name="post_id" value="99">
                        <input type="hidden" name="action" value="like_it">
                    </form>

                </div>
                <section id="comments">

                    <h3 id="comments-title">(<%=commentDaos.size()%>) Comments</h3>

                    <ol class="commentlist">
                        <%
                            Date d = new Date();
                            for(int i=0;i<commentDaos.size();i++){
                                int uid=commentDaos.get(i).getUid();
                                String uname = new UserDao().findUsernameByUid(uid);
                                d = commentDaos.get(i).getTime();
                                int year= d.getYear()+1900;
                                int month=d.getMonth()+1;
                                String MON=new IdeaDao().changeMon(month);
                                int day = d.getDate();
                                int hour =d.getHours();
                                int min=d.getMinutes();
                        %>

                        <li class="comment even thread-even depth-1" id="li-comment-2">
                            <article id="comment-2">

                                <%--<a href="#">
                                    <img alt="" src="http://1.gravatar.com/avatar/50a7625001317a58444a20ece817aeca?s=60&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D60&amp;r=G" class="avatar avatar-60 photo" height="60" width="60">
                                </a>--%>

                                <div class="comment-meta">

                                    <h5 class="author">
                                        <cite class="fn">
                                            <a rel="external nofollow" class="url"><%=uname%></a>
                                        </cite>
                                        - <a class="comment-reply-link">Reply</a><time datetime="2013-02-26T13:18:47+00:00">&nbsp;at&nbsp;<%=hour%>:<%=min%>&nbsp;on&nbsp;<%=MON%>&nbsp;<%=day%>,&nbsp;<%=year%>&nbsp;</time>
                                    </h5>

                                </div><!-- end .comment-meta -->

                                <div class="comment-body">
                                    <p><%=commentDaos.get(i).getContent()%></p>
                                </div><!-- end of comment-body -->

                            </article><!-- end of comment -->
                        </li>
                        <%
                            }
                        %>
                    </ol>

                    <div id="respond">

                        <h3>Leave a Reply</h3>

                        <div class="cancel-comment-reply">
                            <a rel="nofollow" id="cancel-comment-reply-link" href="#" style="display:none;">Click here to cancel reply.</a>
                        </div>


                        <form action="CommentServlet" method="post" id="commentform">
                            <input type="hidden" name="iid" value="<%=iid%>">
                            <input type="hidden" name="username" value=${username} >

                            <div>
                                <label for="comment">Comment</label>
                                <textarea class="span8" name="comment" id="comment" cols="58" rows="10"></textarea>
                            </div>

                            <div>
                                <input class="btn" name="submit" type="submit" id="submit"  value="Submit Comment">
                            </div>

                        </form>

                    </div>

                </section><!-- end of comments -->

            </div>
            <!-- end of page content -->


            <!-- start of sidebar -->
            <aside class="span4 page-sidebar">

                <section class="widget">
                    <div class="support-widget">
                        <h3 class="title">Support</h3>
                        <p class="intro">有任何问题都可以联系我们寻求帮助哦</p>
                    </div>
                </section>


                <section class="widget">
                    <h3 class="title">Featured Ideas</h3>
                    <ul class="articles">
                        <%
                            IdeaDao ideaDao= new IdeaDao();
                            List<IdeaDao> ideaDaos= ideaDao.readByLikes();

                            Date date = new Date();
                            for(int i=0;i<4;i++){
                                date = ideaDaos.get(i).getTime();
                                int year= date.getYear()+1900;
                                int month=date.getMonth()+1;
                                String MON=ideaDao.changeMon(month);
                                int day = date.getDate();
                        %>
                        <li class="article-entry standard">
                            <h4><a href="single.jsp?id=<%=ideaDaos.get(i).getIid()%>"><%=ideaDaos.get(i).getSubject()%></a></h4>
                            <span class="article-meta"><%=day%>&nbsp;<%=MON%>,&nbsp;<%=year%>&nbsp;in <a href="#" title="View all posts in Server &amp; Database"><%=ideaDaos.get(i).getCategories()%></a></span>
                            <span class="like-count"><%=ideaDaos.get(i).getLikes()%></span>
                        </li>
                        <%
                            }

                        %>
                    </ul>
                </section>



                <section class="widget"><h3 class="title">Categories</h3>
                    <ul>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Advanced Techniques</a> </li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Designing in WordPress</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Server &amp; Database</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet, ">Theme Development</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Website Dev</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">WordPress for Beginners</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet, ">WordPress Plugins</a></li>
                    </ul>
                </section>

            </aside>
            <!-- end of sidebar -->
        </div>
    </div>
</div>
<!-- End of Page Container -->

<!-- Start of Footer -->
<footer id="footer-wrapper">
    <div id="footer" class="container">
        <div class="row">

            <div class="span3">
                <section class="widget">
                    <h3 class="title">How it works</h3>
                    <div class="textwidget">
                        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
                        <p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </p>
                    </div>
                </section>
            </div>

            <div class="span3">
                <section class="widget"><h3 class="title">Categories</h3>
                    <ul>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Advanced Techniques</a> </li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Designing in WordPress</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Server &amp; Database</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet, ">Theme Development</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">Website Dev</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet,">WordPress for Beginners</a></li>
                        <li><a href="#" title="Lorem ipsum dolor sit amet, ">WordPress Plugins</a></li>
                    </ul>
                </section>
            </div>

            <div class="span3">
                <section class="widget">
                    <h3 class="title">Latest Tweets</h3>
                    <div id="twitter_update_list">
                        <ul>
                            <li>No Tweets loaded !</li>
                        </ul>
                    </div>
                    <script src="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js" type="text/javascript"></script>
                    <script type="text/javascript" >
                        getTwitters("twitter_update_list", {
                            id: "960development",
                            count: 3,
                            enableLinks: true,
                            ignoreReplies: true,
                            clearContents: true,
                            template: "%text% <span>%time%</span>"
                        });
                    </script>
                </section>
            </div>

            <div class="span3">
                <section class="widget">
                    <h3 class="title">Flickr Photos</h3>
                    <div class="flickr-photos" id="basicuse">
                    </div>
                </section>
            </div>

        </div>
    </div>
    <!-- end of #footer -->

    <!-- Footer Bottom -->
    <div id="footer-bottom-wrapper">
        <div id="footer-bottom" class="container">
            <div class="row">
                <div class="span6">
                    <p class="copyright">
                        Copyright &copy; 2018.nananer7 All rights reserved.<a target="_blank" href="http://sc.chinaz.com/moban/">&#x7F51;&#x9875;&#x6A21;&#x677F;</a>
                    </p>
                </div>
                <div class="span6">
                    <!-- Social Navigation -->
                    <ul class="social-nav clearfix">
                        <li class="linkedin"><a target="_blank" href="#"></a></li>
                        <li class="stumble"><a target="_blank" href="#"></a></li>
                        <li class="google"><a target="_blank" href="#"></a></li>
                        <li class="deviantart"><a target="_blank" href="#"></a></li>
                        <li class="flickr"><a target="_blank" href="#"></a></li>
                        <li class="skype"><a target="_blank" href="skype:#?call"></a></li>
                        <li class="rss"><a target="_blank" href="#"></a></li>
                        <li class="twitter"><a target="_blank" href="#"></a></li>
                        <li class="facebook"><a target="_blank" href="#"></a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- End of Footer Bottom -->

</footer>
<!-- End of Footer -->

<a href="#top" id="scroll-top"></a>

<!-- script -->
<script type='text/javascript' src='js/jquery-1.8.3.min.js'></script>
<script type='text/javascript' src='js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='js/prettyphoto/jquery.prettyPhoto.js'></script>
<script type='text/javascript' src='js/jflickrfeed.js'></script>
<script type='text/javascript' src='js/jquery.liveSearch.js'></script>
<script type='text/javascript' src='js/jquery.form.js'></script>
<script type='text/javascript' src='js/jquery.validate.min.js'></script>
<script type='text/javascript' src='js/custom.js'></script>

<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>

